package com.lanou.renrenxin.activity;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.widget.ImageView;

import com.lanou.renrenxin.R;
import com.lanou.renrenxin.base.BaseActivity;

/**
 * Created by dllo on 16/3/5.
 */
public class ShoppingActivity extends BaseActivity implements View.OnClickListener {
    private WebView wv_shopping;
    private ImageView imageView;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_shopping);

        wv_shopping = (WebView) findViewById(R.id.wv_shopping);
        wv_shopping.loadUrl("http://wq.jd.com/mcoss/mportal/show?tabid=17&tpl=17&PTAG=17007.4.1&ptype=1");

        imageView = (ImageView) findViewById(R.id.shopping_iv_back);
        imageView.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.shopping_iv_back:
                showShoppingBackDialog();
                break;
        }
    }

    private void showShoppingBackDialog() {
        final AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle("您要关闭购物页面吗？");
        builder.setNegativeButton("再逛逛", null);
        builder.setPositiveButton("关闭", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                back();
            }

            private void back() {
                finish();
            }
        });
        builder.show();
    }
}
